package com.林子祺.CAT旅游系统.entity.place;

import com.林子祺.CAT旅游系统.dao.placemanagement.PlacePull;
import com.林子祺.CAT旅游系统.entity.place.CurrentPlaceData;
import com.林子祺.CAT旅游系统.util.PlaceStructure;

import java.util.ArrayList;

public class PlaceData {

    public static ArrayList<PlaceStructure> pd = new ArrayList<>();

    public static void InputData(int id,String name, double price, String provience, String city, String address, String detail){
        pd.add(new PlaceStructure(id,name,price,provience,city,address,detail));
    }

    public static boolean OutputData(int number){
        if(number < pd.size()){
            PlaceStructure p = pd.get(number);
            CurrentPlaceData.id = p.getId();
            CurrentPlaceData.name = p.getName();
            CurrentPlaceData.address = p.getAddress();
            CurrentPlaceData.city = p.getCity();
            CurrentPlaceData.provience = p.getProvience();
            CurrentPlaceData.detail = p.getDetail();
            CurrentPlaceData.price = p.getPrice();
            return true;
        }
        else
            return false;
    }

    public static void Refresh(){

            pd.removeAll(pd);

    }

}
